import request from '@/utils/request'

/**
 * 获取用户列表(分页)
 */
export function getUserList(pageNum = 1, pageSize = 10, keyword = '') {
  return request({
    url: '/auth/user/list',
    method: 'get',
    params: { pageNum, pageSize, keyword }
  })
}

/**
 * 添加用户
 */
export function addUser(data) {
  return request({
    url: '/auth/user/add',
    method: 'post',
    data
  })
}

/**
 * 更新用户
 */
export function updateUser(id, data) {
  return request({
    url: `/auth/user/update/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除用户
 */
export function deleteUser(id) {
  return request({
    url: `/auth/user/delete/${id}`,
    method: 'delete'
  })
}

/**
 * 启用/禁用用户
 */
export function updateUserStatus(id, status) {
  return request({
    url: `/auth/user/status/${id}`,
    method: 'put',
    params: { status }
  })
}
